{include file=header.html}
<script src="{lib file=mlselection.js}" charset="utf-8"></script>
<script src="{lib file=jquery.plugins/jquery.validate.js}" charset="utf-8"></script>
<style type="text/css">
.d_inline{display:inline;}
</style>
<div class="content">
<script type="text/javascript">
//<!CDATA[
var SITE_URL = "{$site_url}";
var REAL_SITE_URL = "{$real_site_url}";
$(function(){
    regionInit("region");

    $("#apply_form").validate({
        errorPlacement: function(error, element){
            var error_td = element.parents('td').next('td');
            error_td.find('.field_notice').hide();
            error_td.find('.fontColor3').hide();
            error_td.append(error);
        },
        success: function(label){
            label.addClass('validate_right').text('OK!');
        },
        onkeyup: false,
        rules: {
            owner_name: {
                required: true
            },
            store_name: {
                required: true,
                remote : {
                    url  : 'index.php?app=apply&act=check_name&ajax=1',
                    type : 'get',
                    data : {
                        store_name : function(){
                            return $('#store_name').val();
                        },
                        store_id : '{$store.store_id}'
                    }
                },
                maxlength: 20
            },
            tel: {
                required: true,
                minlength:6,
                checkTel:true
            },
            image_1: {
                accept: "jpg|jpeg|png|gif"
            },
            image_2: {
                accept: "jpg|jpeg|png|gif"
            },
            image_3: {
                accept: "jpg|jpeg|png|gif"
            },
            notice: {
                required : true
            }
        },
        messages: {
            owner_name: {
                required: '{$lang.input_owner_name}'
            },
            store_name: {
                required: '{$lang.input_store_name}',
                remote: '{$lang.name_exist}',
                maxlength: '{$lang.note_for_store_name}'
            },
            tel: {
                required: '{$lang.input_tel}',
                minlength: '{$lang.phone_tel_error}',
                checkTel: '{$lang.phone_tel_error}'
            },
            image_1: {
                accept: '{$lang.select_valid_image}'
            },
            image_2: {
                accept: '{$lang.select_valid_image}'
            },
            image_3: {
                accept: '{$lang.select_valid_image}'
            },
            notice: {
                required: '{$lang.check_notice}'
            }
        }
    });
});
//]]>
</script>
    <div class="module_common">
        <h2><b class="set_up_shop" title="SHOP REGISTRATION{$lang.i_want_open_store}"></b></h2>
        <div class="wrap">
            <div class="wrap_child">

                <div class="module_new_shop">

                    <div class="chart">
                        <div class="pos_x1 bg_a1" title="{$lang.step_1}"></div>
                        <div class="pos_x2 bg_b2" title="{$lang.step_2}"></div>
                        <div class="pos_x3 bg_c" title="{$lang.step_3}"></div>
                    </div>

                    <div class="info_shop">
                        <form method="post" enctype="multipart/form-data" id="apply_form">
                        <table>
                            <tr>
                                <th>{$lang.owner_name}: </th>
                                <td class="width7"><input type="text" class="text width7" name="owner_name" value="{$store.owner_name|escape}"/></td>
                                <td class="padding3"><span class="fontColor3">*</span> <span class="field_notice">{$lang.note_for_owner_name}</span></td>
                            </tr>
                            <tr>
                                <th>{$lang.owner_card}: </th>
                                <td><input type="text" class="text width7" name="owner_card"/ value="{$store.owner_card|escape}"></td>
                                <td class="padding3"> <span class="field_notice">{$lang.note_for_owner_card}</span></td>
                            </tr>
                            <tr>
                                <th>{$lang.store_name}: </th>
                                <td><input type="text" class="text width7" name="store_name" id="store_name" value="{$store.store_name|escape}"/></td>
                                <td class="padding3"><span class="fontColor3">*</span> <span class="field_notice">{$lang.note_for_store_name}</span></td>
                            </tr>
                            <tr>
                                <th>{$lang.store_category}: </th>
                                <td>
                                    <div class="select_add"><select name="cate_id">
                                    <option value="0">{$lang.select_pls}</option>
                                    {html_options options=$scategories selected=$scategory.cate_id}
                                    </select>
                                    </div>
                                </td>
                                <td></td>
                            </tr>
                            <tr>
                                <th>{$lang.region}: </th>
                                <td>
                                <div class="select_add" id="region" style="width:500px;border:1px solide red;">
                                    <input type="hidden" name="region_id" value="{$store.region_id}" class="mls_id" />
                                    <input type="hidden" name="region_name" value="{$store.region_name}" class="mls_names" />
                                    {if $store.region_name}
                                    <span>{$store.region_name|escape}</span>
                                    <input type="button" value="{$lang.edit}" class="edit_region" />
                                    {/if}
                                    <select class="d_inline"{if $store.region_name} style="display:none;"{/if}>
                                    <option value="0">{$lang.select_pls}</option>
                                    {html_options options=$regions}
                                    </select>
                                </div>
                                </td>
                                <td></td>
                            </tr>
                            <tr>
                                <th>{$lang.address}: </th>
                                <td><input type="text" class="text width7" name="address" value="{$store.address|escape}"/></td>
                                <td></td>
                            </tr>
                            <tr>
                                <th>{$lang.zipcode}: </th>
                                <td><input type="text" class="text width7" name="zipcode" value="{$store.zipcode|escape}"/></td>
                                <td></td>
                            </tr>
                            <tr>
                                <th>{$lang.tel}: </th>
                                <td>
                                    <input type="text" class="text width7" name="tel"  value="{$store.tel|escape}"/>
                                </td>
                                <td class="padding3"><span class="fontColor3">*</span> <span class="field_notice">{$lang.input_tel}</span></td>
                            </tr>
                            <tr>
                                <th>{$lang.upload_image}: </th>
                                <td><input type="file" name="image_1" />
                                {if $store.image_1}<p style="display:inline;"><a href="{$site_url}/{$store.image_1}" target="_blank">{$lang.view}</a></p>{/if}
                                </td>
                                <td class="padding3"><span class="field_notice">{$lang.note_for_image}</span></td>
                            </tr>
                            <tr>
                                <th>{$lang.upload_permit}: </th>
                                <td><input type="file" name="image_2" />
                                {if $store.image_2}<p style="display:inline;"><a href="{$site_url}/{$store.image_2}" target="_blank">{$lang.view}</a></p>{/if}
                                </td>
                                <td class="padding3"><span class="field_notice">{$lang.note_for_image}</span></td>
                            </tr>
                            <tr>
                                <td colspan="2"><p class="padding4"><input type="checkbox"{if $store} checked="checked"{/if} name="notice" value="1" id="warning" /> <label for="warning">{$lang.notice}</label></p></td>
                                <td></td>
                            </tr>
                            <tr>
                                <td colspan="3"><p class="padding4"><input class="btn" type="submit" value="" /></p></td>
                            </tr>
                        </table>
                        </form>
                    </div>

                </div>

            </div>
        </div>
    </div>

</div>
{include file=footer.html}
